<SCRIPT type="text/javascript">
	var ztree ;
	var setting = {
		data: {
			simpleData: {
				enable: true
			}
		},
		callback: {
			onExpand: function(){
				if (treeNiceScroll) {
					treeNiceScroll.resize();
				}
			}
		},
		view: {
			showLine: false
		}
	};
	var zNodes1 =[
		{ id:"0", pId:"0", name:"公共文件夹", open:true , url:"/${orgi}/manage/reports/0/index.html?code=cur" ,icon:"/assets/images/icon-file-closed.png", target:"_self"}
		<#if dicList??>
		<#list dicList as dic>
		,{ id:"${dic.id!''}", pId:"${dic.parentid!''}", name:"${dic.name!''}", icon:"/assets/images/icon-file-closed.png" , url:"/${orgi}/manage/reports/${dic.id}/index.html?code=cur" , target:"_self"}
		</#list>
		</#if>
		<#if reportList ??>
			<#list reportList as rep>
				,{ id:"${rep.id!''}", pId:"${rep.dicid!''}", name:"${rep.name!''}", icon:"/assets/images/icon-tablesAvailableList.png" , url:"/${orgi}/manage/reports/${rep.id}/index.html" , target:"_self"}
			</#list>
		</#if>
	];
	$(document).ready(function(){
		var ztree = $.fn.zTree.init($(document.getElementById("zTree_adminLIst")), setting, zNodes1);
		ztree.selectNode(ztree.getNodeByParam("id", "${type!''}", null));
	});
</SCRIPT>
<SCRIPT type="text/javascript">
	function dblclick(id,paramtype,paramvalue,value,key){
		var type = paramtype;
		var va = ""; 
		//获取上次双击选中的id和值
		var sid = $("#hid_id").val();
		if(sid == id){
			return;
		}
		var sval = $("#hid_val").val();
		value = $("#div_"+id).html().trim();
		//将本次选中的id赋值到隐藏域中
		$("#hid_id").val(id);
		$("#hid_val").val(value);
		$("#hid_key").val(key);
		//文本框
		if(type == null || type== "" || type == undefined || type =="1"){
			if(value==""  || value==undefined || value == null){
				va = "<input type ='text' name = 'value' style='padding:0px;width:300px' value = '' id = "+id+" onkeypress='keypress()' onblur='mouseclick()'>";
			}else{
				va = "<input type ='text' name = 'value' style='padding:0px;width:300px' value = "+value+" id = "+id+" onkeypress='keypress()' onblur='mouseclick()'>";
			}
		//下拉框	
		}else if (type == "2"){
			if(paramvalue != null || paramvalue != "" || paramvalue != undefined){
				var pva =  paramvalue.split(",");
				var con = "";
				for(var i = 0 ; i < pva.length ; i ++){
					var paramv = pva[i].split(":");
					if(paramv.length>=2){
						if(value == paramv[0]){
							con += "<option value = "+paramv[0]+" selected = 'selected'>"+paramv[1]+"</option>";
						}else{
							con += "<option value = "+paramv[0]+">"+paramv[1]+"</option>";
						}
					}else{
						if(value == pva[i]){
							con += "<option value = "+pva[i]+"  selected = 'selected'>"+pva[i]+"</option>";
						}else{
							con += "<option value = "+pva[i]+">"+pva[i]+"</option>";
						}
					}
				}
				va = "<select name = 'value' style='padding:0px;height:20px' onchange='change()' id = 'select' onblur='mouseclick()'>"+con+
				"</select><input type ='hidden' name = 'value' style='padding:0px;width:300px' value = "+value+" id = "+id+">";
			}
		//颜色
		}else if (type == "3"){
			va = "<blockquote><input type ='text' name = 'value' class='colorpicker' style='padding:0px;width:300px' value = "+value+" id = "+id+" onkeypress='keypress()' ></blockquote>";
		//日历
		}else if (type == "4"){
		
		}
		//还原上次文本触发的事件
		if(sid != "" || sid != null || sid != undefined){
			$("#div_"+sid).html(sval);
		}
		//更新本次触发的事件
		$("#div_"+id).html(va);
		//获取焦点
		$("#"+id).val("").focus().val(value);
		//给颜色选择器绑定颜色空间，其他的事件不绑定
		if(type == "3"){
			//绑定颜色选择器
			$("#"+id).colorpicker({
				fillcolor:true,
	    		target:$("#"+id),
	    		success:function(){
	    			mouseclick();
	    		}
			}); 
		}
	}
	
	function mouseclick(){
		var sid = $("#hid_id").val();
		var sval = $("#hid_val").val();
		change();
		var value = $("#select").val();
		if(value == null || value == "" || value ==undefined){
			value = $("#"+sid).val();
		}
		if(value == sval){
			if(sid != "" || sid != null || sid != undefined){
				$("#div_"+sid).html(sval);
			}
			$("#hid_id").val("");
		}
	}
	function change(){
		var id = $("#hid_id").val();
		$("#p_id").val(id);
		var value = $("#select").val();
		if(value == null || value == "" || value ==undefined){
			value = $("#"+id).val();
		}
		$("#p_value").val(value);
		var sval = $("#hid_val").val();
		var key = $("#hid_key").val();
		var stype = $("#hid_stype").val();
		var code = $("#hid_code").val();
		if(sval != value){
			if(key == "system.config.reportdata.title"){
				if(stype =="reportdata" && (code != null || code !="" || code !=undefined)){
					$("#mainForm").submit();
				}else{
					 $("#div_"+id).html(sval);
					 $("#hid_id").val("");
				}
			}else if(key == "system.config.report.tilte"){
				if(stype =="reports" && (code == null || code =="" || code ==undefined)){
					 $("#mainForm").submit();
				}else{
					$("#div_"+id).html(sval);
					$("#hid_id").val("");
				}
			}else{
				loadURL("/${orgi}/manage/reports/${type}/propertiessettingeditdof.html?id="+id+"&value="+encodeURIComponent(value),"#tempdiv",
				function(propertiesList){
					var sid = $("#hid_id").val();
					if(sid != "" || sid != null || sid != undefined){
						$("#div_"+sid).html(value);
						$("#hid_val").val(value);
						$("#hid_id").val("");
					}
				});
			}
		}
		
	}
	
	//执行回车事件
	document.keypress =  function(event){
		var e = event || window.event || arguments.callee.caller.arguments[0];
		if(e.keyCode == 13){
			var id = $("#hid_id").val();
			$("#p_id").val(id);
			var value = $("#select").val();
			if(value == null || value == "" || value ==undefined){
				value = $("#"+id).val();
			}
			$("#p_value").val(value);
			var sval = $("#hid_val").val();
			var key = $("#hid_key").val();
			var stype = $("#hid_stype").val();
			var code = $("#hid_code").val();
			if(sval != value){
				if(key == "system.config.reportdata.title"){
				if(stype =="reportdata" && (code != null || code !="" || code !=undefined)){
					$("#mainForm").submit();
				}else{
					 $("#div_"+id).html(sval);
					 $("#hid_id").val("");
				}
			}else if(key == "system.config.report.tilte"){
				if(stype =="reports" && (code == null || code =="" || code ==undefined)){
					 $("#mainForm").submit();
				}else{
					$("#div_"+id).html(sval);
					$("#hid_id").val("");
				}
			}else{
					loadURL("/${orgi}/manage/reports/${type}/propertiessettingeditdof.html?id="+id+"&value="+encodeURIComponent(value),"#tempdiv",
					function(propertiesList){
						var sid = $("#hid_id").val();
						if(sid != "" || sid != null || sid != undefined){
							$("#div_"+sid).html(value);
							$("#hid_val").val(value);
							$("#hid_id").val("");
						}
					});
				}
			}
		}
	}
</SCRIPT>
<div class="rs_layout_top breadCrumbWrap">
	<div class="breadCrumbStart">您当前的位置是在：</div>
	<ul class="breadCrumb">
		<li class="bc_ithems"><a href="/${orgi}/manage/task/taskpassing.html">系统管理</a></li>
		<li class="bc_ithems"><a href="/${orgi}/manage/reports/report/index.html">报表设置</a></li>
	</ul>
</div>
<div class="rs_layout_left" resizable="true" style="width:230px;">
	<div class="lftTreeWrap">
		<div class="ztree" id="zTree_adminLIst"></div>
	</div>
</div>
<!--<div class="rs_layout_right" style="width:300px;"></div>-->
<form class="form-horizontal" id="mainForm" data-toggle="ajax" action="/${orgi}/manage/reports/${type}/propertiessettingeditdo.html" method="post">
<input type="hidden" name = "id" id = "p_id"/>
<input type="hidden" name = "value" id = "p_value"/>
<input type="hidden" name = "stype" value = "${stype}" id = "p_stype" />
</form>
<input type ="hidden" value = "" id = "hid_id" />
<input type ="hidden" value = "" id = "hid_val" />
<input type ="hidden" value = "" id = "hid_key" />
<input type ="hidden" value = "${stype!''}" id = "hid_stype" />
<input type ="hidden" value = "${code!''}" id = "hid_code" />
<div class="rs_layout_center">
	<div class="rs_layout">
		<div class="rs_layout_top">
			<ul class="nav_tapWrap">
				<li class="nav_tapIthems <#if stype ?? && stype == 'reports'>cur</#if>" style="padding-bottom:0px"><a href="/${orgi}/manage/reports/${type}/index.html?code=cur"><i class="tabIcon"></i>报表设置</a></li>
				
				<li class="nav_tapIthems <#if stype ?? && stype == 'reportdata'>cur</#if>" style="padding-bottom:0px"><a href="/${orgi}/manage/reports/${type}/reportsetting.html"><i class="tabIcon"></i>数据设置</a></li>
				
			</ul> 
		</div>
		<div class="rs_layout_center">
			
			<div class="tableScrollWrap">
				 <table class="table_style_1">
					<thead>
						<tr>
						   	<th style="width:50px;">&nbsp;</th>  
							<th style="width:240px;">参数名称</th>
							<th>值</th>
						</tr>
					</thead>
					<tbody>
						<#if propertiesList??>
						<#list propertiesList as properties>
						<tr>
							<td class="minSize"></td>
							<td style="width:240px;">
								${properties.title!''}
							</td>
							<td style="width:840px;" ondblclick="dblclick('${properties.id!""}','${properties.paramtype!""}','${properties.paramvalue!""}','${properties.value!""}','${properties.name!""}')">
								<div id = "div_${properties.id}" >
									<#assign templateSource = "${properties.value!''}"> 
									<#assign inlineTemplate = templateSource?interpret> 
									<@inlineTemplate />  
								</div>
							</td>
						</tr>
						</#list>
						</#if>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>